package com.example.demo.Service;

import com.example.demo.Entity.Directoryitem;
import com.example.demo.Entity.Note;
import com.example.demo.Mapper.DirectoryitemMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DirectoryitemServiceImp implements DirectoryitemService {

    @Autowired
    private  DirectoryitemMapper directoryitemMapper;

    @Override
    public List<Directoryitem> findDirectoryitemByUserId(int userId){
        return directoryitemMapper.findDirectoryitemByUserId(userId);
    }
    @Override
    public void insertDirectoryitem(Directoryitem directoryitem) {
            directoryitemMapper.insert(directoryitem);
    }
    @Override
    public void updateDirectoryitem(Directoryitem directoryitem) {
        directoryitemMapper.insertOrUpdate(directoryitem);
    }
   @Override
    public void deleteDirectoryitem(Directoryitem directoryitem) {
        directoryitemMapper.deleteById(directoryitem);
   }
   @Override
   public List<Note> findNoteByDirectoryId(int directoryId){
        return directoryitemMapper.findNoteByDirectoryId(directoryId);
   }
   @Override
   public void deleteDirectoryitemById(int directoryId){
         directoryitemMapper.deleteByDirectoryId(directoryId);
   }
   @Override
    public Directoryitem selectByDirectoryId(int directoryId){
      return   directoryitemMapper.selectByDirectoryId(directoryId);
   }
   @Override
   public Directoryitem selectByDirectoryName(String directoryName){
        return directoryitemMapper.selectByDirectoryName(directoryName);
   }
}
